<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ movie.title }} - 电影详情</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #8e44ad;
            --primary-dark: #6c3483;
            --secondary: #f8f9fa;
            --text-color: #333;
            --light-gray: #f1f1f1;
            --medium-gray: #e0e0e0;
            --dark-gray: #777;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: var(--text-color);
            background-color: #f9f9f9;
        }
        
        .movie-detail-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem 1rem;
        }
        
        .detail-header {
            background: linear-gradient(135deg, var(--primary), #9b59b6);
            color: white;
            padding: 2.5rem 2rem;
            border-radius: 15px 15px 0 0;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        .detail-header h1 {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
        }
        
        .detail-header p {
            font-size: 1.1rem;
            opacity: 0.9;
        }
        
        .detail-poster {
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 10px 25px rgba(0,0,0,0.15);
            transition: transform 0.3s ease;
            margin-bottom: 1.5rem;
        }
        
        .detail-poster:hover {
            transform: scale(1.02);
        }
        
        .detail-poster img {
            width: 100%;
            height: auto;
            display: block;
        }
        
        .meta-card {
            border: none;
            border-radius: 12px;
            background-color: white;
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
            margin-bottom: 2rem;
        }
        
        .detail-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }
        
        .detail-meta span {
            display: inline-flex;
            align-items: center;
            background: rgba(142, 68, 173, 0.1);
            padding: 0.5rem 1rem;
            border-radius: 50px;
            font-size: 0.95rem;
        }
        
        .detail-meta i {
            margin-right: 0.5rem;
            color: var(--primary);
        }
        
        .cast-section {
            margin-top: 1.5rem;
        }
        
        .cast-section h5 {
            font-weight: 600;
            margin-bottom: 0.75rem;
            color: var(--primary-dark);
        }
        
        .plot-card {
            border: none;
            border-radius: 12px;
            background-color: white;
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
            margin-bottom: 2rem;
            overflow: hidden;
        }
        
        .plot-card h4 {
            font-weight: 600;
            color: var(--primary-dark);
            margin-bottom: 1rem;
        }
        
        .plot-card p {
            line-height: 1.7;
            color: var(--dark-gray);
        }
        
        .showtimes-section h3 {
            font-weight: 600;
            margin-bottom: 1.5rem;
            color: var(--primary-dark);
            position: relative;
            padding-bottom: 0.75rem;
        }
        
        .showtimes-section h3::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 60px;
            height: 3px;
            background-color: var(--primary);
        }
        
        .cinema-card {
            border: none;
            border-radius: 12px;
            margin-bottom: 1.5rem;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
        }
        
        .cinema-header {
            background: linear-gradient(90deg, var(--primary), #9b59b6);
            color: white;
            padding: 1.25rem 1.5rem;
            border-radius: 12px 12px 0 0;
        }
        
        .cinema-header h4 {
            font-size: 1.3rem;
            margin-bottom: 0.25rem;
        }
        
        .cinema-header p {
            font-size: 0.9rem;
            opacity: 0.9;
            margin-bottom: 0;
        }
        
        .cinema-body {
            padding: 1.5rem;
            background-color: white;
        }
        
        .showtime-row {
            display: flex;
            flex-wrap: wrap;
            gap: 1rem;
            margin: 0 -0.5rem;
        }
        
        .showtime-card {
            flex: 1 1 calc(50% - 1rem);
            min-width: 250px;
            border: 1px solid var(--medium-gray);
            border-radius: 10px;
            padding: 1.25rem;
            transition: all 0.3s ease;
            margin: 0.5rem;
        }
        
        .showtime-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
            border-color: var(--primary);
        }
        
        .showtime-details {
            display: flex;
            justify-content: space-between;
            margin-bottom: 1rem;
        }
        
        .showtime-left h5 {
            font-size: 1.2rem;
            margin-bottom: 0.25rem;
            color: var(--text-color);
        }
        
        .showtime-left p {
            font-size: 0.9rem;
            color: var(--dark-gray);
            margin-bottom: 0;
        }
        
        .showtime-right p {
            margin-bottom: 0.25rem;
            font-size: 0.95rem;
        }
        
        .showtime-price {
            font-weight: 600;
            color: var(--primary-dark);
        }
        
        .showtime-seats {
            color: #28a745;
            font-size: 0.85rem;
        }
        
        .book-btn {
            display: block;
            width: 100%;
            padding: 0.75rem;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-weight: 600;
            transition: background-color 0.3s ease;
            text-align: center;
            text-decoration: none;
        }
        
        .book-btn:hover {
            background-color: var(--primary-dark);
            color: white;
        }
        
        .book-btn i {
            margin-right: 0.5rem;
        }
        
        @media (max-width: 768px) {
            .detail-header h1 {
                font-size: 2rem;
            }
            
            .showtime-card {
                flex: 1 1 100%;
            }
        }
    </style>
</head>
<body>
    <div class="movie-detail-container">
        <div class="detail-header">
            <h1>{{ movie.title }}</h1>
            <p>{{ movie.director }} | {{ movie.release_date.year }} | {{ movie.duration }}分钟</p>
        </div>
        
        <div class="row mt-4">
            <div class="col-lg-4 mb-4">
                <div class="detail-poster">
                     <img src="{{ url_for('static', filename='images/movie/' + movie.poster_url) }}" class="img-fluid" alt="{{ movie.title }}">
                </div>
                
                <div class="card meta-card">
                    <div class="card-body p-4">
                        <div class="detail-meta">
                            <span><i class="fas fa-star"></i> 评分: {{ movie.rating }}</span>
                            <span><i class="fas fa-film"></i> {{ movie.genre }}</span>
                            <span><i class="fas fa-language"></i> {{ movie.language }}</span>
                        </div>
                        
                        <div class="cast-section">
                            <h5>主演</h5>
                            <p>{{ movie.actors }}</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="col-lg-8">
                <div class="card plot-card">
                    <div class="card-body p-4">
                        <h4>剧情简介</h4>
                        <p>{{ movie.description }}</p>
                    </div>
                </div>
                
                <div class="showtimes-section">
                    <h3>场次信息</h3>
                    
                    {% for cinema_id, cinema_data in cinemas.items() %}
                    <div class="card cinema-card">
                        <div class="cinema-header">
                            <h4>{{ cinema_data.name }}</h4>
                            <p>{{ cinema_data.address }}</p>
                        </div>
                        
                        <div class="cinema-body">
                            <div class="showtime-row">
                                {% for show in cinema_data.shows %}
                                <div class="showtime-card">
                                    <div class="showtime-details">
                                        <div class="showtime-left">
                                            <h5>{{ show.start_time }}</h5>
                                            <p>{{ show.hall }}号厅</p>
                                        </div>
                                        <div class="showtime-right">
                                            <p class="showtime-price">¥{{ show.price }}</p>
                                            <p class="showtime-seats">{{ show.available_seats }}个座位</p>
                                        </div>
                                    </div>
                                    <a href="/booking/{{ show.id }}" class="book-btn">
                                        <i class="fas fa-ticket-alt"></i> 选座购票
                                    </a>
                                </div>
                                {% endfor %}
                            </div>
                        </div>
                    </div>
                    {% endfor %}
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>